package com.xiaoxi.bridgemode.function;

import com.xiaoxi.bridgemode.realization.DisplayImpl;

import java.util.Random;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.bridgemode.function
 * @ClassName CountDisplay
 * @Description TODO
 * @Date 2023/3/13 19:56
 * @Version 1.0
 */
public class RandomDisplay extends Display {

    public RandomDisplay(DisplayImpl display) {
        super(display);
    }

    public final void randomDisplay(int times) {
        open();
        int nextInt = new Random().nextInt(times);
        for (int i = 0; i < nextInt; i++) {
            print();
        }
        close();
    }

}
